.class public Lcom/bitauto/autoeasy/news/Object/NewsContentParser;
.super Ljava/lang/Object;
.source "NewsContentParser.java"


# static fields
.field private static final AUTHOR:Ljava/lang/String; = "Author"

.field private static final CONTENT:Ljava/lang/String; = "Content"

.field private static final MODIFYTIME:Ljava/lang/String; = "PublishTime"

.field private static final TAG:Ljava/lang/String; = "NewsContentParser"

.field private static final TITLE:Ljava/lang/String; = "Title"


# instance fields
.field private url:Ljava/lang/String;


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 28
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 24
    const-string v0, ""

    iput-object v0, p0, Lcom/bitauto/autoeasy/news/Object/NewsContentParser;->url:Ljava/lang/String;

    .line 29
    return-void
.end method

.method public constructor <init>(Ljava/lang/String;)V
    .locals 1
    .parameter "url"

    .prologue
    .line 31
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 24
    const-string v0, ""

    iput-object v0, p0, Lcom/bitauto/autoeasy/news/Object/NewsContentParser;->url:Ljava/lang/String;

    .line 32
    iput-object p1, p0, Lcom/bitauto/autoeasy/news/Object/NewsContentParser;->url:Ljava/lang/String;

    .line 33
    return-void
.end method


# virtual methods
.method public Paser2Object()Lcom/bitauto/autoeasy/news/Object/News;
    .locals 9

    .prologue
    const/4 v6, 0x0

    const-string v8, "error :"

    const-string v7, "NewsContentParser"

    const-string v4, "Content"

    .line 42
    :try_start_0
    iget-object v4, p0, Lcom/bitauto/autoeasy/news/Object/NewsContentParser;->url:Ljava/lang/String;

    invoke-static {v4}, Lcom/bitauto/autoeasy/tool/Caller;->doGet(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    .line 43
    .local v3, str:Ljava/lang/String;
    if-eqz v3, :cond_0

    .line 44
    new-instance v2, Lcom/bitauto/autoeasy/news/Object/News;

    invoke-direct {v2}, Lcom/bitauto/autoeasy/news/Object/News;-><init>()V

    .line 45
    .local v2, news:Lcom/bitauto/autoeasy/news/Object/News;
    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1, v3}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 46
    .local v1, jObj:Lorg/json/JSONObject;
    invoke-virtual {p0, v1}, Lcom/bitauto/autoeasy/news/Object/NewsContentParser;->build(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/news/Object/News;

    move-result-object v2

    .line 49
    const-string v4, "Content"

    invoke-virtual {v1, v4}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v4

    const/4 v5, 0x0

    invoke-virtual {v4, v5}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v4

    const-string v5, "Content"

    invoke-virtual {v4, v5}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v2, v4}, Lcom/bitauto/autoeasy/news/Object/News;->setContent(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Lcom/bitauto/autoeasy/tool/WSError; {:try_start_0 .. :try_end_0} :catch_1

    move-object v4, v2

    .line 59
    .end local v1           #jObj:Lorg/json/JSONObject;
    .end local v2           #news:Lcom/bitauto/autoeasy/news/Object/News;
    .end local v3           #str:Ljava/lang/String;
    :goto_0
    return-object v4

    .restart local v3       #str:Ljava/lang/String;
    :cond_0
    move-object v4, v6

    .line 53
    goto :goto_0

    .line 54
    .end local v3           #str:Ljava/lang/String;
    :catch_0
    move-exception v4

    move-object v0, v4

    .line 55
    .local v0, e:Lorg/json/JSONException;
    const-string v4, "NewsContentParser"

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "error :"

    invoke-direct {v4, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v7, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    move-object v4, v6

    .line 56
    goto :goto_0

    .line 57
    .end local v0           #e:Lorg/json/JSONException;
    :catch_1
    move-exception v4

    move-object v0, v4

    .line 58
    .local v0, e:Lcom/bitauto/autoeasy/tool/WSError;
    const-string v4, "NewsContentParser"

    new-instance v4, Ljava/lang/StringBuilder;

    const-string v5, "error :"

    invoke-direct {v4, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Lcom/bitauto/autoeasy/tool/WSError;->getMessage()Ljava/lang/String;

    move-result-object v5

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-static {v7, v4}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    move-object v4, v6

    .line 59
    goto :goto_0
.end method

.method public build(Lorg/json/JSONObject;)Lcom/bitauto/autoeasy/news/Object/News;
    .locals 5
    .parameter "obj"

    .prologue
    .line 87
    new-instance v1, Lcom/bitauto/autoeasy/news/Object/News;

    invoke-direct {v1}, Lcom/bitauto/autoeasy/news/Object/News;-><init>()V

    .line 89
    .local v1, news:Lcom/bitauto/autoeasy/news/Object/News;
    :try_start_0
    const-string v2, "Title"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcom/bitauto/autoeasy/news/Object/News;->setTitle(Ljava/lang/String;)V

    .line 90
    const-string v2, "PublishTime"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Lcom/bitauto/autoeasy/tool/ToolBox;->String2Date(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcom/bitauto/autoeasy/news/Object/News;->setModifytime(Ljava/lang/String;)V

    .line 92
    const-string v2, "Author"

    invoke-virtual {p1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lcom/bitauto/autoeasy/news/Object/News;->setAuthor(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    move-object v2, v1

    .line 96
    :goto_0
    return-object v2

    .line 94
    :catch_0
    move-exception v2

    move-object v0, v2

    .line 95
    .local v0, e:Lorg/json/JSONException;
    const-string v2, "NewsContentParser"

    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "error :"

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Lorg/json/JSONException;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I

    .line 96
    const/4 v2, 0x0

    goto :goto_0
.end method

.method public setUrl(Ljava/lang/String;)V
    .locals 0
    .parameter "url"

    .prologue
    .line 36
    iput-object p1, p0, Lcom/bitauto/autoeasy/news/Object/NewsContentParser;->url:Ljava/lang/String;

    .line 37
    return-void
.end method
